/**
 * output package name
 */
package com.kingdee.eas.custom.yq.df.client;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.swing.JLabel;

import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectBlock;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.bos.metadata.entity.SelectorItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.UIException;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.base.commonquery.client.CommonQueryDialog;
import com.kingdee.eas.base.netctrl.IMutexServiceControl;
import com.kingdee.eas.base.netctrl.MutexServiceControlFactory;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.base.permission.client.longtime.ILongTimeTask;
import com.kingdee.eas.base.permission.client.longtime.LongTimeDialog;
import com.kingdee.eas.base.permission.client.util.UITools;
import com.kingdee.eas.basedata.assistant.AccountBankFactory;
import com.kingdee.eas.basedata.assistant.AccountBankInfo;
import com.kingdee.eas.basedata.assistant.PeriodFactory;
import com.kingdee.eas.basedata.assistant.PeriodInfo;
import com.kingdee.eas.basedata.assistant.PeriodUtils;
import com.kingdee.eas.basedata.assistant.SystemStatusCtrolUtils;
import com.kingdee.eas.basedata.master.account.AccountViewFactory;
import com.kingdee.eas.basedata.master.account.AccountViewInfo;
import com.kingdee.eas.basedata.org.CompanyOrgUnitFactory;
import com.kingdee.eas.basedata.org.CtrlUnitInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.OprtState;
import com.kingdee.eas.common.client.SysContext;
import com.kingdee.eas.common.client.UIContext;
import com.kingdee.eas.common.client.UIFactoryName;
import com.kingdee.eas.custom.yq.df.AuthorityConfigCollection;
import com.kingdee.eas.custom.yq.df.AuthorityConfigFactory;
import com.kingdee.eas.custom.yq.df.BillStatuEnum;
import com.kingdee.eas.custom.yq.df.ISubstituting;
import com.kingdee.eas.custom.yq.df.SubstitutingCollection;
import com.kingdee.eas.custom.yq.df.SubstitutingEntryCollection;
import com.kingdee.eas.custom.yq.df.SubstitutingEntryFactory;
import com.kingdee.eas.custom.yq.df.SubstitutingFactory;
import com.kingdee.eas.custom.yq.df.SubstitutingInfo;
import com.kingdee.eas.custom.yq.df.SyncSubstitutingStateByBillFacade;
import com.kingdee.eas.custom.yq.df.SyncSubstitutingStateByBillFacadeFactory;
import com.kingdee.eas.custom.yq.sk.TransDetailFacadeFactory;
import com.kingdee.eas.custom.yq.util.ConstantValueUtil;
import com.kingdee.eas.deppon.journal.JournalFacadeFactory;
import com.kingdee.eas.fdc.basedata.FDCSQLBuilder;
import com.kingdee.eas.fi.cas.CasException;
import com.kingdee.eas.fi.cas.JournalFactory;
import com.kingdee.eas.fi.cas.JournalInfo;
import com.kingdee.eas.fi.cas.JournalTypeEnum;
import com.kingdee.eas.fi.cas.RecPayException;
import com.kingdee.eas.fi.cas.app.JournalAddBatchDelegate;
import com.kingdee.eas.fm.be.BEException;
import com.kingdee.eas.fm.be.SubmitPasswordFactory;
import com.kingdee.eas.fm.common.FMConstants;
import com.kingdee.eas.fm.common.FMHelper;
import com.kingdee.eas.fm.common.FMVerifyHelper;
import com.kingdee.eas.fm.common.client.MutexUtils;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.framework.SystemEnum;
import com.kingdee.eas.ma.crbg.BillstateEnum;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.EASResource;
import com.kingdee.eas.util.client.MsgBox;

/**
 * 描述：代发单列表界面 作者：mmw 创建日期：2012-10-25-下午06:43:23
 */
@SuppressWarnings( { "unused", "serial", "unchecked" })
public class SubstitutingListUI extends AbstractSubstitutingListUI {
	private static final Logger logger = CoreUIObject.getLogger(SubstitutingListUI.class);

	/**
	 * output class constructor
	 */
	public SubstitutingListUI() throws Exception {
		super();
	}

	private UserInfo currecyUser = null;
	private CtrlUnitInfo cu = null;
	private CommonQueryDialog queryDlg = null;
	private MyCommonQueryUI filterUI = null;
	// 过滤条件
	private FilterInfo filter = new FilterInfo();

	public FilterInfo getFilter() {
		return filter;
	}

	public void setFilter(FilterInfo filter) {
		this.filter = filter;
	}

	public void onShow() throws Exception {
		super.onShow();
	}

	public void onLoad() throws Exception {
		super.onLoad();
		setBtnStatus();
		// 获取当前组织
		cu = SysContext.getSysContext().getCurrentCtrlUnit();
		// 用户实体
		currecyUser = SysContext.getSysContext().getCurrentUserInfo();
		// 用户id
		String currecyUserId = currecyUser.getId().toString();
		List list = getdataBySize(currecyUserId);
		Set<String> number = new HashSet<String>();
		for (int i = 0; i < list.size(); i++) {
			number.add(list.get(i).toString());
		}
		// 根据用户id，取出权限配置基础资料的数，来过滤出用户所能看到收付类别数据
		if (list.size() < 1) {
			filter.getFilterItems().add(new FilterItemInfo("feeType.number", CompareType.EMPTY));
		} else {
			filter.getFilterItems().add(new FilterItemInfo("feeType.number", number, CompareType.INCLUDE));
		}
		setFilter(filter);
		// //主要获得查询界面的过滤条件
		// FilterInfo filters = mainQuery.getFilter();
		// try {
		// //加上权限配置的过滤条件
		// filters.mergeFilter(getFilter(), "and");
		// } catch (BOSException e) {
		// e.printStackTrace();
		// }
		// mainQuery.setFilter(filters);
		actionRefresh_actionPerformed(null);
		// //添加监听，当点击单据数时，设置功能按钮的是否启用状态
		// tblMain.addKDTSelectListener(new KDTSelectListener(){
		// public void tableSelectChanged(KDTSelectEvent arg0) {
		// setBtnStatu();
		// }
		// });
	}

	/**
	 * 描述：设置按钮的是否隐藏及功能按钮的图标
	 */
	private void setBtnStatus() {
		menuItemAddNew.setVisible(false);
		menuItemAddNew.setEnabled(false);
		MenuItemAttachment.setVisible(false);
		menuEdit.setVisible(false);
		menuEdit.setEnabled(false);
		menuItemLocate.setVisible(false);
		menuItemTraceDown.setVisible(false);
		menuItemTraceUp.setVisible(false);
		menuWorkFlow.setVisible(false);
		btnAttachment.setVisible(false);
		btnAuditResult.setVisible(false);
		// 禁用新增
		btnAddNew.setEnabled(false);
		// 禁用修改
		btnEdit.setEnabled(false);
		// 禁用删除
		btnRemove.setEnabled(false);

		// ************2013-08-01 修改人:刘鹏 不同意&审批按钮取消**************
		btnNotAgreed.setVisible(false);// 不同意
		btnAudit.setVisible(false);

		btnSyncStateByBill.setEnabled(true);// 按单据同步状态
		btnRegisterJournal.setEnabled(true);// 补登银行日记账
		// btnAudit.setEnabled(true);//审批
		// btnNotAgreed.setEnabled(true);//不同意
		btnCancelled.setEnabled(true);// 作废
		btnSubmitPaying.setEnabled(true);// 提交银企
		btnAudit.setIcon(EASResource.getIcon("imgTbtn_audit"));// 审批
		btnNotAgreed.setIcon(EASResource.getIcon("imgTbtn_distributedeletcalog"));// 不同意
		btnCancelled.setIcon(EASResource.getIcon("imgTbtn_cancelcheckadjust"));// 作废
		btnSubmitPaying.setIcon(EASResource.getIcon("imgTbtn_submit"));// 提交银企互联
		btnSyncStateByBill.setIcon(EASResource.getIcon("imgTbtn_synchronization"));// 按单据同步状态
		btnRegisterJournal.setIcon(EASResource.getIcon("imgTbtn_addcredence"));// 登银行日记账
	}

	protected void execQuery() {
		FilterInfo filters = mainQuery.getFilter();
		try {
			// 点击查询时，加上权限配置的过滤条件
			filters.mergeFilter(getFilter(), "and");
		} catch (BOSException e) {
			e.printStackTrace();
		}
		mainQuery.setFilter(filters);
		super.execQuery();
	}

	/**
	 * 描述：根据用户id获取代发单权限配置的数据集合,并根据CU过滤
	 * 
	 * @param currecyUserId
	 * @return
	 */
	private List getdataBySize(String currecyUserId) {
		// 收付类别编码
		List list = new ArrayList();
		// 避免编码重复使用
		Map map = new HashMap();
		// 获取当前组织
		CtrlUnitInfo cu = SysContext.getSysContext().getCurrentCtrlUnit();
		try {
			FilterInfo filter = new FilterInfo();
			EntityViewInfo view = new EntityViewInfo();
			filter.getFilterItems().add(new FilterItemInfo("personnel", currecyUserId, CompareType.EQUALS));
			// filter.getFilterItems().add(new
			// FilterItemInfo("CU.id",cu.getId().
			// toString(),CompareType.EQUALS));
			SelectorItemCollection sic = new SelectorItemCollection();
			sic.add(new SelectorItemInfo("feeType.number"));
			view.setSelector(sic);
			view.setFilter(filter);
			// 获得代发单权限配置集合
			AuthorityConfigCollection coll = AuthorityConfigFactory.getRemoteInstance().getAuthorityConfigCollection(view);
			if (coll != null) {
				for (int i = 0; i < coll.size(); i++) {
					String number = coll.get(i).getFeeType().getNumber();
					if (number != null && !number.equals("")) {
						if (!map.containsKey(number)) {
							map.put(number, number);
							list.add(number);
						}
					}
				}
			}
		} catch (BOSException e) {
			e.printStackTrace();
		}
		return list;
	}

	/**
	 * 描述:去掉CU过滤
	 */
	protected boolean isIgnoreCUFilter() {
		return true;
	}

	// /***
	// * 描述：改变按钮是否可以（审批、不同意、作废、提交银企）
	// * 0:已提交 10:已审批 20:已付款30:不同意40:作废
	// * 当单据状态为已提交，则审批，不同意按钮可用，作废，提交银企按钮不可用。
	// * 当单据状态为已审批，则提交银企按钮可用，审批，不同意，作废按钮不可用。
	// * 当单据状态为不同意，则作废按钮可用，审批，不同意，提交银企按钮不可用。
	// * 当单据状态为作废，则作废，审批，不同意，提交银企按钮不可用。
	// */
	// protected void setBtnStatu() {
	// checkSelected();
	// List idList = getSelectedIdValues();
	// if (checkStatusISSame()) {
	// KDTSelectBlock bolock = tblMain.getSelectManager().get();
	// IRow row1 = tblMain.getRow(bolock.getTop());
	// String status = row1.getCell("billStatus").getValue().toString();
	// if (status.equals(BillStatuEnum.SUBMIT.getAlias())) {
	// changeStatusByBillStatus(true, true, false, false);
	// } else if (status.equals(BillStatuEnum.AUDITOR.getAlias())) {
	// changeStatusByBillStatus(false, false, false, true);
	// } else if (status.equals(BillStatuEnum.PAYING.getAlias()) ||
	// status.equals(BillStatuEnum.CANCELLED.getAlias())) {
	// changeStatusByBillStatus(false, false, false, false);
	// } else if (status.equals(BillStatuEnum.NOTAGREED.getAlias())) {
	// changeStatusByBillStatus(false, false, true, false);
	// }
	// } else {
	// changeStatusByBillStatus(false, false, false, false);
	// }
	// }
	//	
	// /**
	// * 描述：改变按钮是否可用
	// * @param c：审批
	// * @param a：不同意
	// * @param b：作废
	// * @param d：提交银企
	// */
	// private void changeStatusByBillStatus(boolean c, boolean a, boolean b,
	// boolean d) {
	// btnAudit.setEnabled(c);
	// btnNotAgreed.setEnabled(a);
	// btnCancelled.setEnabled(b);
	// btnSubmitPaying.setEnabled(d);
	// }

	/**
	 * 描述：审批按钮功能
	 */
	public void actionBtnAudit_actionPerformed(ActionEvent e) throws Exception {
		super.actionBtnAudit_actionPerformed(e);
		checkSelected();
		List idList = getSelectedIdValues();
		// start edit by maomingwu 20130714 加入功能互斥锁
		Set idSetCorrectNew = new HashSet();
		try {
			IMutexServiceControl iMutex = MutexServiceControlFactory.getRemoteInstance();
			// 批量申请数据互斥锁
			Map resultRequest = iMutex.batchRequestObjIDForUpdate(idList);
			// 数据申请不成功，返回false，给予提示.
			for (int i = 0; i < idList.size(); i++) {
				Boolean boolResult = (Boolean) resultRequest.get(idList.get(i));
				if (!(boolResult.booleanValue())) {
					MsgBox.showInfo("单据已被锁定，无法进行此功能操作！");
					SysUtil.abort();
				} else {
					idSetCorrectNew.add(idList.get(i));
				}
			}
			// end edit by maomingwu 20130714 加入功能互斥锁
			if (checkStatusISSame()) {
				// KDTSelectBlock bolock = tblMain.getSelectManager().get();
				// IRow row1 = tblMain.getRow(bolock.getTop());
				// String status =
				// row1.getCell("billStatus").getValue().toString();

				// start edit by maomingwu 20130714 获取后台数据实时数据，较为准确
				if (idList.size() < 1) {
					MsgBox.showInfo("未获取界面单据数据，请重新选择！");
					return;
				}
				ISubstituting ISubstituting = null;
				try {
					ISubstituting = SubstitutingFactory.getRemoteInstance();
				} catch (BOSException e1) {
					e1.printStackTrace();
				}
				SubstitutingInfo subinfo = null;
				String id = idList.get(0).toString();
				try {
					subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
				} catch (EASBizException e3) {
					MsgBox.showInfo("获取代发单实体失败！");
					SysUtil.abort();
				} catch (BOSException e3) {
					MsgBox.showInfo("获取代发单实体失败！");
					SysUtil.abort();
				}
				String status = subinfo.getBillStatus().getAlias();
				// end edit by maomingwu 20130714 获取后台数据实时数据，较为准确

				// 当单据状态满足已提交时，可进行审批
				if (status.equals(BillStatuEnum.SUBMIT.getAlias())) {

					updatestate(e, BillStatuEnum.AUDITOR, "auditor");

				} else {
					MsgBox.showInfo("只有单据状态为‘已提交’时，才可以进行审批！");
				}
			} else {
				MsgBox.showInfo("单据状态不一致，不能进行审批操作！");
			}
			// start edit by maomingwu 20130714 功能互斥锁 释放
		} catch (Exception en) {
			logger.error("SubstitutingListUI actionBtnSubmitPaying error:" + en.getMessage());
		} finally {
			// 重置释放数据互斥锁
			List idCorrectS = new ArrayList(idSetCorrectNew);
			MutexUtils.releaseMutex(idCorrectS);
		}
		// end edit by maomingwu 20130714 功能互斥锁释放
	}

	/**
	 * 描述：不同意按钮功能
	 */
	public void actionBtnNotAgreed_actionPerformed(ActionEvent e) throws Exception {
		super.actionBtnNotAgreed_actionPerformed(e);
		checkSelected();
		List idList = getSelectedIdValues();
		// start edit by maomingwu 20130714 加入功能互斥锁
		Set idSetCorrectNew = new HashSet();
		try {
			IMutexServiceControl iMutex = MutexServiceControlFactory.getRemoteInstance();
			// 批量申请数据互斥锁
			Map resultRequest = iMutex.batchRequestObjIDForUpdate(idList);
			// 数据申请不成功，返回false，给予提示.
			for (int i = 0; i < idList.size(); i++) {
				Boolean boolResult = (Boolean) resultRequest.get(idList.get(i));
				if (!(boolResult.booleanValue())) {
					MsgBox.showInfo("单据已被锁定，无法进行此功能操作！");
					SysUtil.abort();
				} else {
					idSetCorrectNew.add(idList.get(i));
				}
			}
			// end edit by maomingwu 20130714 加入功能互斥锁
			if (checkStatusISSame()) {
				// KDTSelectBlock bolock = tblMain.getSelectManager().get();
				// IRow row1 = tblMain.getRow(bolock.getTop());
				// String status =
				// row1.getCell("billStatus").getValue().toString();

				// start edit by maomingwu 20130714 获取后台数据实时数据，较为准确
				if (idList.size() < 1) {
					MsgBox.showInfo("未获取界面单据数据，请重新选择！");
					return;
				}
				ISubstituting ISubstituting = null;
				try {
					ISubstituting = SubstitutingFactory.getRemoteInstance();
				} catch (BOSException e1) {
					e1.printStackTrace();
				}
				SubstitutingInfo subinfo = null;
				String id = idList.get(0).toString();
				try {
					subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
				} catch (EASBizException e3) {
					MsgBox.showInfo("获取代发单实体失败！");
					SysUtil.abort();
				} catch (BOSException e3) {
					MsgBox.showInfo("获取代发单实体失败！");
					SysUtil.abort();
				}
				String status = subinfo.getBillStatus().getAlias();
				// end edit by maomingwu 20130714 获取后台数据实时数据，较为准确

				// 当单据状态满足已提交时，可进行不同意
				if (status.equals(BillStatuEnum.SUBMIT.getAlias())) {

					updatestate(e, BillStatuEnum.NOTAGREED, "notAgreed");

				} else {
					MsgBox.showInfo("只有单据状态为‘已提交’时，才可以进行不同意！");
				}
			} else {
				MsgBox.showInfo("单据状态不一致，不能进行不同意操作！");
			}
			// start edit by maomingwu 20130714 功能互斥锁 释放
		} catch (Exception en) {
			logger.error("SubstitutingListUI actionBtnSubmitPaying error:" + en.getMessage());
		} finally {
			// 重置释放数据互斥锁
			List idCorrectS = new ArrayList(idSetCorrectNew);
			MutexUtils.releaseMutex(idCorrectS);
		}
		// end edit by maomingwu 20130714 功能互斥锁释放
	}

	/**
	 * 描述：作废按钮功能
	 */
	public void actionBtnCancelled_actionPerformed(ActionEvent e) throws Exception {
		super.actionBtnCancelled_actionPerformed(e);
		checkSelected();
		List idList = getSelectedIdValues();
		// start edit by maomingwu 20130714 加入功能互斥锁
		Set idSetCorrectNew = new HashSet();
		try {
			IMutexServiceControl iMutex = MutexServiceControlFactory.getRemoteInstance();
			// 批量申请数据互斥锁
			Map resultRequest = iMutex.batchRequestObjIDForUpdate(idList);
			// 数据申请不成功，返回false，给予提示.
			for (int i = 0; i < idList.size(); i++) {
				Boolean boolResult = (Boolean) resultRequest.get(idList.get(i));
				if (!(boolResult.booleanValue())) {
					MsgBox.showInfo("单据已被锁定，无法进行此功能操作！");
					SysUtil.abort();
				} else {
					idSetCorrectNew.add(idList.get(i));
				}
			}
			// end edit by maomingwu 20130714 加入功能互斥锁
			if (checkStatusISSame()) {
				// KDTSelectBlock bolock = tblMain.getSelectManager().get();
				// IRow row1 = tblMain.getRow(bolock.getTop());
				// String status =
				// row1.getCell("billStatus").getValue().toString();

				// start edit by maomingwu 20130714 获取后台数据实时数据，较为准确
				if (idList.size() < 1) {
					MsgBox.showInfo("未获取界面单据数据，请重新选择！");
					return;
				}
				ISubstituting ISubstituting = null;
				try {
					ISubstituting = SubstitutingFactory.getRemoteInstance();
				} catch (BOSException e1) {
					e1.printStackTrace();
				}
				SubstitutingInfo subinfo = null;
				String id = idList.get(0).toString();
				try {
					subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
				} catch (EASBizException e3) {
					MsgBox.showInfo("获取代发单实体失败！");
					SysUtil.abort();
				} catch (BOSException e3) {
					MsgBox.showInfo("获取代发单实体失败！");
					SysUtil.abort();
				}
				String status = subinfo.getBillStatus().getAlias();
				// end edit by maomingwu 20130714 获取后台数据实时数据，较为准确

				// 2013-08-01 修改人:刘鹏 修改内容:银企二期所有推过来的代发单状态都为已审批,验证单据状态不同意的即可去掉
				// 当单据状态满足不同意时，可进行作废
				// if(status.equals(BillStatuEnum.NOTAGREED.getAlias())){
				//
				// updatestate(e, BillStatuEnum.CANCELLED,"cancelled");
				//
				// }else{
				// MsgBox.showInfo("只有单据状态为‘不同意’时，才可以进行作废！");
				// }
				// 当单据状态为已审批时,可进行作废 2013-08-01 刘鹏
				if (status.equals(BillstateEnum.AUDITED.getAlias())) {
					// 修改代发单单据状态为作废,反写源单据字段"是否下推"字段为未下推,删除相关银行日记账
					updatestate(e, BillStatuEnum.CANCELLED, "cancelled");
					MsgBox.showInfo("代发单作废操作成功!");
				} else {
					MsgBox.showInfo("单据状态为已审批状态才可进行作废操作!");
					SysUtil.abort();
				}
			} else {
				MsgBox.showInfo("单据状态不一致，不能进行作废操作！");
			}
			// start edit by maomingwu 20130714 功能互斥锁 释放
		} catch (Exception en) {
			logger.error("SubstitutingListUI actionBtnSubmitPaying error:" + en.getMessage());
		} finally {
			// 重置释放数据互斥锁
			List idCorrectS = new ArrayList(idSetCorrectNew);
			MutexUtils.releaseMutex(idCorrectS);
		}
		// end edit by maomingwu 20130714 功能互斥锁释放
	}

	/**
	 * 描述：提交银企互联按钮功能
	 */
	public void actionBtnSubmitPaying_actionPerformed(ActionEvent e) throws Exception {
		super.actionBtnSubmitPaying_actionPerformed(e);
		checkSelected();
		List idList = getSelectedIdValues();

		// 优化一期代码,功能未变 不允许批量提交 -----刘鹏
		if (idList.size() > 1) {
			try {
				throw new BEException(BEException.NOTALLOWBATCHSUBMIT);
			} catch (BEException e2) {
				MsgBox.showInfo(e2.getMessage());
				SysUtil.abort();
			}
		}
		ISubstituting subBiz = null;
		subBiz = SubstitutingFactory.getRemoteInstance();
		SubstitutingInfo subinfo = null;
		String id = idList.get(0).toString();
		subinfo = subBiz.getSubstitutingInfo(new ObjectUuidPK(id));
		// end edit by maomingwu 20130714 获取后台数据实时数据，较为准确

		// 当单据状态满足审批时，可进行提交银企互联
		if (subinfo.getBillStatus().equals(BillStatuEnum.AUDITOR)) {
			Set idSetCorrectNew = new HashSet();
			try {
				// start edit by xuwei 20130713 加入功能互斥锁
				IMutexServiceControl iMutex = MutexServiceControlFactory.getRemoteInstance();
				// 批量申请数据互斥锁
				Map resultRequest = iMutex.batchRequestObjIDForUpdate(idList);
				// 数据申请不成功，返回false，给予提示.
				for (int i = 0; i < idList.size(); i++) {
					Boolean boolResult = (Boolean) resultRequest.get(idList.get(i));
					if (!(boolResult.booleanValue())) {
						MsgBox.showInfo("单据已被锁定，无法提交银企");
					} else {
						idSetCorrectNew.add(idList.get(i));
					}
				}
				// end edit by xuwei 20130713 加入功能互斥锁
				// start edit by maomingwu 20130713  有互斥锁   此功能去除
//				// 增加判断，单据是否提交银企的值，是否已勾选，若勾选，则操作正在进行中，直接弹出提示不允许操作
//				checkStates(idList);
				// end edit by maomingwu 20130713
				// 增加判断，单据是否提交银企的值，是否已勾选，若勾选，则操作正在进行中，直接弹出提示不允许操作
				LongTimeDialog ltDlg = UITools.getDialog(this);
				modifyLongTimeDialogAttribute(ltDlg, "您好，数据正在提交中，请稍等...");
				ltDlg.setLongTimeTask(new ILongTimeTask() {

					final long s2 = System.currentTimeMillis();

					public Object exec() throws Exception {
						List idList = getSelectedIdValues();
						Set idSet = FMHelper.list2Set(idList);
						// 若提交银企互联需要密码,则弹出密码输入框,
						checkPassword();
						try {
							// 电脑IP
							InetAddress addr = null;
							try {
								addr = InetAddress.getLocalHost();
							} catch (UnknownHostException e) {
								e.printStackTrace();
							}
							String ip = addr.getHostAddress().toString();
							// 电脑名称
							String computerName = addr.getHostName().toString();
							SubstitutingFactory.getRemoteInstance().pay("", idSet, ip, computerName);
							
						} catch (BEException e1) {
							MsgBox.showConfirm3a("提交异常，请看详细日志！", e1.getMessage());
							return "";
						}
						return "success";
					}

					public void afterExec(Object reult) throws Exception {
						if (reult != "" && reult != null) {
							if (reult.toString().equals("success")) {
								long s3 = System.currentTimeMillis();
								MsgBox.showInfo("提交银企互联操作已完成,时间为:" + (s3 - s2) / 1000 + "s");
							}
						}
					}
				});

				ltDlg.show();

				// 刷新
				super.actionRefresh_actionPerformed(e);
				// start edit by xuwei 20130713 功能互斥锁 释放
			} catch (Exception en) {
				logger.error("SubstitutingListUI actionBtnSubmitPaying error:" + en.getMessage());
			} finally {
				// 重置释放数据互斥锁
				List idCorrectS = new ArrayList(idSetCorrectNew);
				MutexUtils.releaseMutex(idCorrectS);
			}
			// end edit by xuwei 20130713 功能互斥锁释放
		} else {
			MsgBox.showInfo("只有单据状态为‘已审批’时，才可以进行提交银企互联！");
		}
	}

	/**
	 * 描述：//检查单据状态是否满足条件(即必须为已审核状态),若不满足这弹出提示框 作者：mmw 创建日期：2012-12-3-下午12:00:51
	 * 
	 * @param lists
	 */
	private void checkStates(List lists) {
		// 加判断代码，判断是否提交银企 是否勾选，若是，则弹出提示框并结束程序,若不是，这更新主表是否提交银企字段
		// start edit by maomingwu 20130713
		ISubstituting ISubstituting = null;
		SubstitutingInfo subinfo = null;
		String id = lists.get(0).toString();
		try {
			ISubstituting = SubstitutingFactory.getRemoteInstance();
			subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
		} catch (EASBizException e1) {
			MsgBox.showInfo("获取代发单实体失败！");
			SysUtil.abort();
		} catch (BOSException e1) {
			MsgBox.showInfo("获取代发单实体失败！");
			SysUtil.abort();
		}
		// 加判断代码，判断是否提交银企 是否勾选
		if (subinfo.isIsSubmitBank()) {
			MsgBox.showInfo("此条代发单数据正在进行提交银企操作或已经提交完成！");
			SysUtil.abort();
		}
		// 更新单据是否提交银企为【是】
		try {
			// 提交银企时间默认为当前时间
			subinfo.setSubmitBankDate(new Date());
			// 是否提交银企为true
			subinfo.setIsSubmitBank(true);
			SelectorItemCollection item = new SelectorItemCollection();
			item.add(new SelectorItemInfo("submitBankDate"));
			item.add(new SelectorItemInfo("isSubmitBank"));
			ISubstituting.updatePartial(subinfo, item);
		} catch (Exception e) {
			// 若异常，并提示，结束程序
			MsgBox.showInfo("反写代发单主表是否提交银企字段失败！");
			SysUtil.abort();
		}
		// end edit by maomingwu 20130713//更新单据是否提交银企为【是】
	}

	/**
	 * 描述：若提交银企互联需要密码,则弹出密码输入框, 作者：mmw 创建日期：2012-11-1-上午11:08:08
	 * 
	 * @throws UIException
	 */
	private void checkPassword() throws UIException {
		try {
			String checkFlag = SubmitPasswordFactory.getRemoteInstance().checkPassword("password");
			if ("0".equals(checkFlag))
				return;
		} catch (EASBizException e) {
			e.printStackTrace();
		} catch (BOSException e) {
			e.printStackTrace();
		}
		UIContext uiContext = new UIContext(this);
		IUIWindow uiWindow = null;
		uiWindow = UIFactory.createUIFactory(UIFactoryName.MODEL).create((com.kingdee.eas.fm.be.client.SubmitPasswordUI.class).getName(), uiContext, null, OprtState.ADDNEW);
		uiWindow.show();
		// if(uiWindow.getUIObject().getUIContext().get("password") == null){
		// SysUtil.abort();
		// }else
		// if(!uiWindow.getUIObject().getUIContext().get("password").equals
		// ("true")){
		// SysUtil.abort();
		// }

		if (uiWindow.getUIObject().getUIContext().get("password") == null || !uiWindow.getUIObject().getUIContext().get("password").equals("true")) {
			// start edit by maomingwu 20130713
			// 若异常，则反写单据是否提交银企字段和时间
			ArrayList idList = getSelectedIdValues();
			ISubstituting ISubstituting = null;
			SubstitutingInfo subinfo = null;
			String id = idList.get(0).toString();
			try {
				ISubstituting = SubstitutingFactory.getRemoteInstance();
				subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
			} catch (EASBizException e3) {
				MsgBox.showInfo("获取代发单实体失败！");
				SysUtil.abort();
			} catch (BOSException e3) {
				MsgBox.showInfo("获取代发单实体失败！");
				SysUtil.abort();
			}
			// 更新单据是否提交银企为【否】
			try {
				// 提交银企时间默认为当前时间
				subinfo.setSubmitBankDate(null);
				// 是否提交银企为true
				subinfo.setIsSubmitBank(false);
				SelectorItemCollection item = new SelectorItemCollection();
				item.add(new SelectorItemInfo("submitBankDate"));
				item.add(new SelectorItemInfo("isSubmitBank"));
				ISubstituting.updatePartial(subinfo, item);
			} catch (Exception e) {
				// 若异常，并提示，结束程序
				MsgBox.showInfo("反写代发单主表是否提交银企字段失败！");
				SysUtil.abort();
			}
			// start edit by maomingwu 20130713
			SysUtil.abort();
		}

	}

	/**
	 * 描述：修改进度加载框标题和标签文本
	 * 
	 * @param longTimeDialog
	 *            进度加载框
	 * @param labelText
	 *            标签文本
	 */
	public static void modifyLongTimeDialogAttribute(LongTimeDialog longTimeDialog, String labelText) {
		Component[] componets = longTimeDialog.getContentPane().getComponents();

		for (int index = 0; index < componets.length; index++) {
			Component component = componets[index];
			if (component instanceof JLabel) {
				((JLabel) component).setText(labelText);
				break;
			}
		}
	}

	/**
	 * 描述：检查是否有打回数据，若有则false，反正true///此方法作废
	 * 
	 * @return
	 */
	private boolean checkStatusIsBack() {
		// 根据选择的某个或多个分录的数据，将付款状态手动改变
		ArrayList bolock = tblMain.getSelectManager().getBlocks();
		IRow row1 = tblMain.getRow(((KDTSelectBlock) bolock.get(0)).getTop());
		String firstRowStatu = row1.getCell("billStatus").getValue().toString();
		for (int i = 0; i < bolock.size(); i++) {
			// 获得选中分录的块
			KDTSelectBlock selectBlock = (KDTSelectBlock) bolock.get(i);
			for (int j = selectBlock.getTop(); j <= selectBlock.getBottom(); j++) {
				IRow row = tblMain.getRow(j);
				String id = row.getCell("id").getValue().toString();
				// 获取单据信息是否打回，打回则不能提交银企互联
				boolean var = checkisbackTOValues(id);
				if (var) {
					return false;
				}
			}
		}
		return true;
	}

	/**
	 * 描述：当单多选时，校验多选数据中，单据状态是否相同，若状态不相同，则不允许做任何操作。
	 * 
	 * @return
	 */
	private boolean checkStatusISSame() {
		// start edit by maomingwu 20130714 获取界面块数据，不是及时数据，现改为直接获取数据库数据
		ArrayList idList = getSelectedIdValues();
		ISubstituting ISubstituting = null;
		try {
			ISubstituting = SubstitutingFactory.getRemoteInstance();
		} catch (BOSException e) {
			e.printStackTrace();
		}
		SubstitutingInfo subinfo = null;
		BillStatuEnum firstRowStatu = null;
		for (int i = 0; i < idList.size(); i++) {
			String id = idList.get(i).toString();
			try {
				subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
			} catch (EASBizException e3) {
				MsgBox.showInfo("获取代发单实体失败！");
				SysUtil.abort();
			} catch (BOSException e3) {
				MsgBox.showInfo("获取代发单实体失败！");
				SysUtil.abort();
			}
			if (i == 0) {
				firstRowStatu = subinfo.getBillStatus();
			} else {
				if (subinfo.getBillStatus() != firstRowStatu) {
					return false;
				}
			}
		}
		// end edit by maomingwu 20130714获取界面块数据，不是及时数据，现改为直接获取数据库数据
		return true;
	}

	/**
	 * 描述：若单据分录中有打回的记录，则返回true，即不允许提交银企///此方法作废
	 * 
	 * @param id
	 * @return
	 */
	private boolean checkisbackTOValues(String id) {
		try {
			FilterInfo filter = new FilterInfo();
			EntityViewInfo view = new EntityViewInfo();
			filter.getFilterItems().add(new FilterItemInfo("parent", id, CompareType.EQUALS));
			SelectorItemCollection sic = new SelectorItemCollection();
			sic.add("isBackTo");
			view.setFilter(filter);
			view.setSelector(sic);
			SubstitutingEntryCollection entrycoll = SubstitutingEntryFactory.getRemoteInstance().getSubstitutingEntryCollection(view);
			if (entrycoll != null && entrycoll.size() > 0) {
				for (int i = 0; i < entrycoll.size(); i++) {
					if ((entrycoll.get(i).isIsBackTo())) {
						return true;
					}
				}
			}
		} catch (BOSException e) {
			e.printStackTrace();
		}
		return false;
	}

	/**
	 * 描述：按单据id修改单据状态
	 * 
	 * @param e
	 * @param s
	 *            :单据状态
	 * @param Btntype
	 *            :auditor;notAgreed;cancelled;
	 * @throws BOSException
	 * @throws EASBizException
	 * @throws Exception
	 */
	private void updatestate(ActionEvent e, BillStatuEnum statu, String Btntype) throws BOSException, EASBizException, Exception {
		checkSelected();
		// 获取选中单据id
		List idList = getSelectedIdValues();
		ISubstituting substituting = SubstitutingFactory.getRemoteInstance();
		if (idList.size() > 0) {
			for (int i = 0; i < idList.size(); i++) {
				String id = idList.get(i).toString();
				SubstitutingInfo info = null;
				FilterInfo filter = new FilterInfo();
				EntityViewInfo view = new EntityViewInfo();
				filter.getFilterItems().add(new FilterItemInfo("id", id, CompareType.EQUALS));
				view.setFilter(filter);
				view.getSelector().add("*");
				view.getSelector().add("feeType.number");
				view.getSelector().add("entrys.sourceId");
				SubstitutingCollection coll = substituting.getSubstitutingCollection(view);
				if (coll != null && coll.size() > 0) {
					info = coll.get(0);
				}
				if (info == null)
					return;
				SelectorItemCollection sic = new SelectorItemCollection();
				sic.add(new SelectorItemInfo("billStatus"));
				info.setBillStatus(statu);

				//**********2013-08-01*******修改人:刘鹏*****************************
				// *8
				// 注释审批判断 二期下推过来的单据状态直接为审批状态 将单据状态更新放在一个事务中执行
				/*
				 * if(Btntype.equals("auditor")){ sic.add(new
				 * SelectorItemInfo("auditor")); sic.add(new
				 * SelectorItemInfo("auditorTime"));
				 * info.setAuditor(currecyUser); info.setAuditorTime(new
				 * Date()); }else
				 */
				if (Btntype.equals("cancelled")) {
					// sic.add(new SelectorItemInfo("cancelledUser"));
					// sic.add(new SelectorItemInfo("cancelledDate"));
					// info.setCancelledUser(currecyUser);
					// info.setCancelledDate(new Date());
					// 反写源单据是否下推字段为未下推
					fWriteField(info);
				}
				// CoreBaseInfo baseinfo = info;
				// substituting.updatePartial(baseinfo, sic);
			}
			refresh(e);
		}
	}

	/**
	 * 描述：反写源单据是否下推字段为未下推 作者：mmw 创建日期：2012-10-24-下午06:52:55
	 * 
	 * @param info
	 *            代发单实体
	 * @throws EASBizException
	 */
	private void fWriteField(SubstitutingInfo info) throws EASBizException {
		// 收付类别编码
		String feetype = info.getFeeType().getNumber();
		// id集合
		Set set = new HashSet();
		SubstitutingEntryCollection coll = info.getEntrys();
		for (int i = 0; i < coll.size(); i++) {
			String sourceid = coll.get(i).getSourceId();
			set.add(sourceid);
			if (sourceid == null || sourceid.equals("")) {
				set = new HashSet();
			}
		}
		if (set.size() > 0) {
			try {
				List list = FMHelper.set2List(set);
				Map map = new HashMap();
				// “付款日期”“支付方式”“付款银行”“付款账号”“是否下推代发单”
				// 工资 CFPayDate,CFPayment,CFPaymentbankID,CFPaymentAccount,
				// CFWhesingle
				// 亲情CFPayDate,CFPayType,CFPayBank,CFPayAccountID,
				// CFIscreatePayment
				// 代收CFRemitDate,CFPayment,CFPayingBankID,CFPayingAccountID,
				// CFIsCreateRepBill
				// 工资
				if (feetype.equals(ConstantValueUtil.WAGES) || feetype.equals(ConstantValueUtil.WAGESN)) {
					checkBillTypeFromId(ConstantValueUtil.WAGES_BOSTYPE, list);
					map.put("table", ConstantValueUtil.TABLE_WAGES);
					map.put("value", ConstantValueUtil.TYPE_VALUETOBOOLEAN);
					map.put("property1", "CFWhesingle");
					map.put("property2", "CFPayDate");
					map.put("property3", "CFPayment");
					map.put("property4", "CFPaymentbankID");
					map.put("property5", "CFPaymentAccount");
					// sdl
					map.put("property6", "cfwhetherbank");
					map.put("idset", set);
					// updateSourceByIDSet(map);
					// 亲情1+1
				} else if (feetype.equals(ConstantValueUtil.KINGSHIPBILL) || feetype.equals(ConstantValueUtil.KINGSHIPBILLN)) {
					checkBillTypeFromId(ConstantValueUtil.KINGSHIPBILL_BOSTYPE, list);
					map.put("table", ConstantValueUtil.TABLE_KINGSHIPBILL);
					map.put("value", ConstantValueUtil.TYPE_VALUETOBOOLEAN);
					map.put("property1", "CFIscreatePayment");
					map.put("property2", "CFPayDate");
					map.put("property3", "CFPayType");
					map.put("property4", "CFPayBank");
					map.put("property5", "CFPayAccountID");
					map.put("idset", set);
					// updateSourceByIDSet(map);
					// 代收货款
				} else if (feetype.equals(ConstantValueUtil.REMITREFUNDBILL)) {
					checkBillTypeFromId(ConstantValueUtil.REMITREFUNDBILL_BOSTYPE, list);
					map.put("table", ConstantValueUtil.TABLE_REMITREFUNDBILL);
					map.put("value", ConstantValueUtil.TYPE_VALUETOBOOLEAN);
					map.put("property1", "CFIsCreateRepBill");
					map.put("property2", "CFRemitDate");
					map.put("property3", "CFPayment");
					map.put("property4", "CFPayingBankID");
					map.put("property5", "CFPayingAccountID");
					map.put("idset", set);
					// updateSourceByIDSet(map);
				}

				if (map.size() != 0)
					updateSubCancelled(info.getString("id"), map);

			} catch (BOSException e) {
				MsgBox.showInfo("更新上游单据收付类别编码" + feetype + "’是否已下推‘字段时：时出错，请检查代发单数据及上游单据！");
				SysUtil.abort();
			}
		} else {
			MsgBox.showInfo("上游单据分录ID为空，作废失败！");
			SysUtil.abort();
		}
	}

	/**
	 * 描述：检验传进来的id是否与传进来的bostype相同， 目的：检查代发单原单据id是否相同并且是否和收付类别相同
	 * 
	 * @param wagesBostype
	 * @param set
	 */
	private void checkBillTypeFromId(String Bostype, List listId) {
		// 将bostyp映射值
		Map map = new HashMap();
		map.put(ConstantValueUtil.WAGES_BOSTYPE, "工资单据");
		map.put(ConstantValueUtil.KINGSHIPBILL_BOSTYPE, "亲情1+1单据");
		map.put(ConstantValueUtil.REMITREFUNDBILL_BOSTYPE, "代收货款单据");
		for (int i = 0; i < listId.size(); i++) {
			BOSUuid bouid = null;
			try {
				bouid = BOSUuid.read(listId.get(i).toString());
			} catch (Exception e) {
				MsgBox.showError("作废失败!\n源单据BOSID为:" + listId.get(i).toString() + "无法识别!");
				SysUtil.abort();
			}
			// 获取代发单的bostype
			BOSObjectType idBostType = bouid.getType();
			if (!Bostype.equals(idBostType.toString())) {
				//若idBostType在map只为空,则表示bostype,若不为空,即可识别的bostypeid,则表示工资/亲情1+1/
				// 代收货款
				String billtype = idBostType.toString();
				if (map.containsKey(idBostType.toString())) {
					billtype = map.get(idBostType.toString()).toString();
				}
				MsgBox.showInfo("代发单上游单据ID的bosType为：" + billtype + ",与收付类别的单据类型bosType为:" + map.get(Bostype) + "不同，请检查数据！");
				SysUtil.abort();
			}
		}
	}

	private void updateSubCancelled(String sId, Map map) throws BOSException {
		SubstitutingFactory.getRemoteInstance().updateCancelled(sId, map);
	}

	/**
	 * 描述：修改代发单的上游单据的分录中’是否下推‘字段为’未下推‘ boolean 0:false 1:true//工资、亲情1+1为boolean
	 * Enum 0:true 1:false代收货款的字段为枚举
	 * 
	 * @param set代表工资
	 *            ,亲情1+1,代收货款id集合
	 * @param pro修改字段名称
	 * @param table表名
	 * @throws BOSException
	 * @throws EASBizException
	 */
	private void updateSourceByIDSet(Map map) throws BOSException, EASBizException {
		try {
			SubstitutingFactory.getRemoteInstance().updateSourceBill(map);
		} catch (BEException e) {
			MsgBox.showWarning(e.getMessage());
			SysUtil.abort();
		}
	}

	/**
	 * 描述：手动执行按单据同步状态 作者：mmw 创建日期：2012-10-22-上午10:15:07
	 * 
	 * @see com.kingdee.eas.custom.yq.df.client.AbstractSubstitutingListUI#actionSyncStateByBill_actionPerformed(java.awt.event.ActionEvent)
	 * @param e
	 * @throws Exception
	 */
	public void actionSyncStateByBill_actionPerformed(ActionEvent e) throws Exception {
		checkSelected();
		List list = getSelectedIdValues();
		if (!checkStatusISSame()) {
			MsgBox.showInfo("单据状态不一致，不能进行按单据同步状态操作！");
			return;
		}
		// KDTSelectBlock bolock = tblMain.getSelectManager().get();
		// IRow row1 = tblMain.getRow(bolock.getTop());
		// String status = row1.getCell("billStatus").getValue().toString();
		// start edit by maomingwu 20130714 获取后台数据实时数据，较为准确
		if (list.size() < 1) {
			MsgBox.showInfo("未获取界面单据数据，请重新选择！");
			return;
		}
		ISubstituting ISubstituting = null;
		try {
			ISubstituting = SubstitutingFactory.getRemoteInstance();
		} catch (BOSException e1) {
			e1.printStackTrace();
		}
		SubstitutingInfo subinfo = null;
		String id = list.get(0).toString();
		try {
			subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
		} catch (EASBizException e3) {
			MsgBox.showInfo("获取代发单实体失败！");
			SysUtil.abort();
		} catch (BOSException e3) {
			MsgBox.showInfo("获取代发单实体失败！");
			SysUtil.abort();
		}
		String status = subinfo.getBillStatus().getAlias();
		// end edit by maomingwu 20130714 获取后台数据实时数据，较为准确

		// 当单据状态满足按单据同步状态时，可进行按单据同步状态
		if (!status.equals(BillStatuEnum.PAYING.getAlias())) {
			MsgBox.showInfo("只有单据状态为‘已付款’时，才可以进行按单据同步状态！");
			return;
		}
		Set idSet = FMHelper.list2Set(list);
		try {
			long s2 = System.currentTimeMillis();
			// 电脑IP
			InetAddress addr = null;
			try {
				addr = InetAddress.getLocalHost();
			} catch (UnknownHostException e1) {
				e1.printStackTrace();
			}
			String ip = addr.getHostAddress().toString();
			// 电脑名称
			String computerName = addr.getHostName().toString();
			// 调用按单据同步状态方法,若
			SubstitutingFactory.getRemoteInstance().queryPay("", idSet, ip, computerName);
			long s3 = System.currentTimeMillis();
			MsgBox.showInfo("按单据操作完成,请点击单据查看数据!所需时间为:" + (s3 - s2) / 1000 + "s");
		} catch (BEException e2) {
			MsgBox.showWarning(e2.getMessage());
		} catch (Exception e2) {
			MsgBox.showConfirm3a("发生异常,请看详细信息!", e2.getMessage());
		}
		try {
			// 登银行日记账//此条件为实发金额不为0
			SubstitutingFactory.getRemoteInstance().registration(idSet);
		} catch (BEException e2) {
			MsgBox.showWarning("登银行日记账错误：" + e2.getMessage());
		} catch (Exception e2) {
			MsgBox.showConfirm3a("登银行日记账发生异常,请看详细信息!", e2.getMessage());
		}
	}

	/**
	 * 描述：补登银行日记账 作者：mmw 创建日期：2012-10-22-下午03:17:34
	 * 
	 * @see com.kingdee.eas.custom.yq.df.client.AbstractSubstitutingListUI#actionRegisterJournal_actionPerformed(java.awt.event.ActionEvent)
	 * @param e
	 * @throws Exception
	 */
	public void actionRegisterJournal_actionPerformed(ActionEvent e) throws Exception {
		checkSelected();
		List idList = this.getSelectedIdValues();
		Set idSet = FMHelper.list2Set(idList);
		Map map = new HashMap();
		// 登银行日记时,记录成功和失败的单据编码
		try {
			map = SubstitutingFactory.getRemoteInstance().registerJournal(idSet);
		} catch (BEException e2) {
			MsgBox.showInfo(e2.getMessage());
			return;
		} catch (Exception e2) {
			MsgBox.showConfirm3a("发生异常,请看详细信息!", e2.getMessage());
			return;
		}
		int successSize = ((Integer) map.get("successSize")).intValue();
		int failedSize = ((Integer) map.get("failedSize")).intValue();
		String successNumbers = ((String) map.get("successNumbers")).toString();
		String failedNumbers = ((String) map.get("failedNumbers")).toString();

		if (successSize == 0) {
			MsgBox.showInfo("没有符合操作条件的记录，请重新选择！");
			SysUtil.abort();
		}

		String msgBeforeFormat = EASResource.getString("com.kingdee.eas.fi.cas.CasResource", "registerJournal");
		String msgAfterFormat = MessageFormat.format(msgBeforeFormat, new Object[] { new Integer(successSize + failedSize), new Integer(successSize), new Integer(failedSize) });

		StringBuffer msgDetail = new StringBuffer();
		msgDetail.append("补登日记账成功的单据编号如下：");
		msgDetail.append(successNumbers);
		msgDetail.append("\r\n");
		msgDetail.append("补登日记账不成功的单据编号如下：");
		msgDetail.append(failedNumbers);
		// 弹出详细的信息框
		MsgBox.showDetailAndOK(this, msgAfterFormat, msgDetail.toString(), 1);

		// 刷新
		refresh(e);
	}

	/***
	 * 描述：初始化过滤框
	 */
	protected CommonQueryDialog initCommonQueryDialog() {
		if (queryDlg != null)
			return queryDlg;
		try {
			queryDlg = new CommonQueryDialog();
			queryDlg.setTitle("代发单过滤界面");
			queryDlg.setOwner((Component) getUIContext().get("Owner"));
			queryDlg.setParentUIClassName(getClass().getName());
			queryDlg.setQueryObjectPK(mainQueryPK);
			queryDlg.setHeight(380);
			queryDlg.setWidth(500);
			queryDlg.addUserPanel(getUserPanel());
			queryDlg.setShowSorter(false);
			queryDlg.setUiObject(this);
		} catch (Exception e) {
			logger.error(e.getMessage(), e.getCause());
		}
		return queryDlg;
		// CommonQueryDialog dialog = super.initCommonQueryDialog();
		// try{
		// dialog.addUserPanel(getUserPanel());
		// dialog.setShowFilter(true);
		// dialog.setShowSorter(true);
		// dialog.setHeight(380);
		// dialog.setWidth(500);
		// dialog.setTitle("条件");
		// }catch (Exception e) {
		// handUIException(e);
		// }
		// return dialog;
	}

	/**
	 * 描述：获得需要弹出的过滤窗口
	 * 
	 * @return
	 * @throws Exception
	 */
	protected MyCommonQueryUI getUserPanel() throws Exception {
		if (filterUI == null)
			filterUI = new MyCommonQueryUI();
		filterUI.setUITitle("代发单过滤界面");
		return filterUI;
		// if (this.userPanel == null)
		// this.userPanel = new MyCommonQueryUI();
		// userPanel.onLoad();
		// return this.userPanel;
	}

	/**
	 * 描述：默认打开代发单时，弹出查询过滤窗口
	 */
	protected boolean initDefaultFilter() {
		return true;
	}

	/**
	 * output storeFields method
	 */
	public void storeFields() {
		super.storeFields();
	}

	/**
	 * output tblMain_tableClicked method
	 */
	protected void tblMain_tableClicked(com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent e) throws Exception {
		super.tblMain_tableClicked(e);
	}

	/**
	 * output tblMain_tableSelectChanged method
	 */
	protected void tblMain_tableSelectChanged(com.kingdee.bos.ctrl.kdf.table.event.KDTSelectEvent e) throws Exception {
		super.tblMain_tableSelectChanged(e);
	}

	/**
	 * output menuItemImportData_actionPerformed method
	 */
	protected void menuItemImportData_actionPerformed(java.awt.event.ActionEvent e) throws Exception {
		super.menuItemImportData_actionPerformed(e);
	}

	/**
	 * output actionPageSetup_actionPerformed
	 */
	public void actionPageSetup_actionPerformed(ActionEvent e) throws Exception {
		super.actionPageSetup_actionPerformed(e);
	}

	/**
	 * output actionExitCurrent_actionPerformed
	 */
	public void actionExitCurrent_actionPerformed(ActionEvent e) throws Exception {
		super.actionExitCurrent_actionPerformed(e);
	}

	/**
	 * output actionHelp_actionPerformed
	 */
	public void actionHelp_actionPerformed(ActionEvent e) throws Exception {
		super.actionHelp_actionPerformed(e);
	}

	/**
	 * output actionAbout_actionPerformed
	 */
	public void actionAbout_actionPerformed(ActionEvent e) throws Exception {
		super.actionAbout_actionPerformed(e);
	}

	/**
	 * output actionOnLoad_actionPerformed
	 */
	public void actionOnLoad_actionPerformed(ActionEvent e) throws Exception {
		super.actionOnLoad_actionPerformed(e);
	}

	/**
	 * output actionSendMessage_actionPerformed
	 */
	public void actionSendMessage_actionPerformed(ActionEvent e) throws Exception {
		super.actionSendMessage_actionPerformed(e);
	}

	/**
	 * output actionCalculator_actionPerformed
	 */
	public void actionCalculator_actionPerformed(ActionEvent e) throws Exception {
		super.actionCalculator_actionPerformed(e);
	}

	/**
	 * output actionExport_actionPerformed
	 */
	public void actionExport_actionPerformed(ActionEvent e) throws Exception {
		super.actionExport_actionPerformed(e);
	}

	/**
	 * output actionExportSelected_actionPerformed
	 */
	public void actionExportSelected_actionPerformed(ActionEvent e) throws Exception {
		super.actionExportSelected_actionPerformed(e);
	}

	/**
	 * output actionRegProduct_actionPerformed
	 */
	public void actionRegProduct_actionPerformed(ActionEvent e) throws Exception {
		super.actionRegProduct_actionPerformed(e);
	}

	/**
	 * output actionPersonalSite_actionPerformed
	 */
	public void actionPersonalSite_actionPerformed(ActionEvent e) throws Exception {
		super.actionPersonalSite_actionPerformed(e);
	}

	/**
	 * output actionProcductVal_actionPerformed
	 */
	public void actionProcductVal_actionPerformed(ActionEvent e) throws Exception {
		super.actionProcductVal_actionPerformed(e);
	}

	/**
	 * output actionExportSave_actionPerformed
	 */
	public void actionExportSave_actionPerformed(ActionEvent e) throws Exception {
		super.actionExportSave_actionPerformed(e);
	}

	/**
	 * output actionExportSelectedSave_actionPerformed
	 */
	public void actionExportSelectedSave_actionPerformed(ActionEvent e) throws Exception {
		super.actionExportSelectedSave_actionPerformed(e);
	}

	/**
	 * output actionKnowStore_actionPerformed
	 */
	public void actionKnowStore_actionPerformed(ActionEvent e) throws Exception {
		super.actionKnowStore_actionPerformed(e);
	}

	/**
	 * output actionAnswer_actionPerformed
	 */
	public void actionAnswer_actionPerformed(ActionEvent e) throws Exception {
		super.actionAnswer_actionPerformed(e);
	}

	/**
	 * output actionRemoteAssist_actionPerformed
	 */
	public void actionRemoteAssist_actionPerformed(ActionEvent e) throws Exception {
		super.actionRemoteAssist_actionPerformed(e);
	}

	/**
	 * output actionPopupCopy_actionPerformed
	 */
	public void actionPopupCopy_actionPerformed(ActionEvent e) throws Exception {
		super.actionPopupCopy_actionPerformed(e);
	}

	/**
	 * output actionHTMLForMail_actionPerformed
	 */
	public void actionHTMLForMail_actionPerformed(ActionEvent e) throws Exception {
		super.actionHTMLForMail_actionPerformed(e);
	}

	/**
	 * output actionExcelForMail_actionPerformed
	 */
	public void actionExcelForMail_actionPerformed(ActionEvent e) throws Exception {
		super.actionExcelForMail_actionPerformed(e);
	}

	/**
	 * output actionHTMLForRpt_actionPerformed
	 */
	public void actionHTMLForRpt_actionPerformed(ActionEvent e) throws Exception {
		super.actionHTMLForRpt_actionPerformed(e);
	}

	/**
	 * output actionExcelForRpt_actionPerformed
	 */
	public void actionExcelForRpt_actionPerformed(ActionEvent e) throws Exception {
		super.actionExcelForRpt_actionPerformed(e);
	}

	/**
	 * output actionLinkForRpt_actionPerformed
	 */
	public void actionLinkForRpt_actionPerformed(ActionEvent e) throws Exception {
		super.actionLinkForRpt_actionPerformed(e);
	}

	/**
	 * output actionPopupPaste_actionPerformed
	 */
	public void actionPopupPaste_actionPerformed(ActionEvent e) throws Exception {
		super.actionPopupPaste_actionPerformed(e);
	}

	/**
	 * output actionAddNew_actionPerformed
	 */
	public void actionAddNew_actionPerformed(ActionEvent e) throws Exception {
		super.actionAddNew_actionPerformed(e);
	}

	/**
	 * output actionView_actionPerformed
	 */
	public void actionView_actionPerformed(ActionEvent e) throws Exception {
		super.actionView_actionPerformed(e);
	}

	/**
	 * output actionEdit_actionPerformed
	 */
	public void actionEdit_actionPerformed(ActionEvent e) throws Exception {
		super.actionEdit_actionPerformed(e);
	}

	/**
	 * output actionRemove_actionPerformed
	 */
	public void actionRemove_actionPerformed(ActionEvent e) throws Exception {
		super.actionRemove_actionPerformed(e);
	}

	/**
	 * output actionRefresh_actionPerformed
	 */
	public void actionRefresh_actionPerformed(ActionEvent e) throws Exception {
		// super.actionRefresh_actionPerformed(e);
		// SyncSubstitutingStateByBillFacadeFactory.getRemoteInstance().
		// syncSubstitutingStateByBill();
		// //工行
		// for (int i = 1; i < 2001; i++) {
		// FDCSQLBuilder fsql=new
		// FDCSQLBuilder();//w5p1/UQzRbSACCYfHM5QdVUJx7I=/
		// /QCwDEvkJQeeg3dyxIsQm6FUJx7I=;2000
		// String sql="insert into ct_yq_substitutingentry values('"+i+
		// "',newbosid('30B94FE0'),'dF8A0OkuR9yKWeoRSVtafVUJx7I=','"
		// +i+"','备晕','6222021001033315687','中国工商银行上海市上外支行','',"+i+
		// ",'test','6a05bcad-00fd-1000-e000-01e6c0a8100d2665126B','直辖市或特别行政区','6a05bcad-00fd-1000-e000-01f4c0a8100d0C5DD6B6','','qENjvVi2S/+YfEKKP2vhFulrK44=','0','0','','','0','0','0','','','');"
		// ;
		// fsql.appendSql(sql);
		// fsql.executeUpdate();
		// System.out.println(i);
		// }
		// //农行
		// for (int i = 1; i < 2001; i++) {
		// FDCSQLBuilder fsql=new
		// FDCSQLBuilder();//w5p1/UQzRbSACCYfHM5QdVUJx7I=/
		// /QCwDEvkJQeeg3dyxIsQm6FUJx7I=;2000
		// String sql="insert into ct_yq_substitutingentry values('"+i+
		// "',newbosid('30B94FE0'),'hRKINr8vTZmDGfvYk1nJtFUJx7I=','"
		// +i+"','高任翠','6228480030741765512','中国农业银行股份有限公司上海徐泾支行','',"+i+
		// ",'test','6a05bcad-00fd-1000-e000-01e6c0a8100d2665126B','直辖市或特别行政区','6a05bcad-00fd-1000-e000-01f4c0a8100d0C5DD6B6','','qENjvVi2S/+YfEKKP2vhFulrK44=','0','0','','','0','0','0','','','');"
		// ;
		// fsql.appendSql(sql);
		// fsql.executeUpdate();
		// System.out.println(i);
		// }

		// String str=
		// TransDetailFacadeFactory.getRemoteInstance().getReceiveDetail(null,
		// null, null, "0", null);
		// System.out.println(str);
		super.actionRefresh_actionPerformed(e);
	}

	public void verifyJournalForAdd(JournalInfo journal) throws BOSException, EASBizException {
		AccountViewInfo accountView = journal.getAccountView();
		boolean val = true;
		if (val && journal.getBizDate().after(journal.getCreateDate()))
			journal.setBizDate(journal.getCreateDate());
		if (journal.getType().equals(JournalTypeEnum.BANK)) {
			if (journal.getAccountBank() == null)
				throw new CasException(CasException.BANKACCT_NULL);
			String acctBankId = journal.getAccountBank().getId().toString();
			SelectorItemCollection sic = new SelectorItemCollection();
			sic.add(new SelectorItemInfo("id"));
			sic.add(new SelectorItemInfo("isClosed"));
			sic.add(new SelectorItemInfo("account.id"));
			sic.add(new SelectorItemInfo("account.isCFreeze"));
			sic.add(new SelectorItemInfo("company.id"));
			AccountBankInfo acctBank;
			acctBank = AccountBankFactory.getRemoteInstance().getAccountBankInfo(new ObjectUuidPK(BOSUuid.read(acctBankId)), sic);
			if (acctBank.isIsClosed())
				throw new CasException(CasException.ACCTBANKCLOSE);
			if (acctBank.getAccount() == null)
				throw new CasException(CasException.ACCT_NOTIDTIWITHBANK);
			if (acctBank.getAccount().isIsCFreeze())
				throw new RecPayException(RecPayException.ACCT_IS_FREEZE);
			if (!acctBank.getAccount().getId().equals(accountView.getId()))
				throw new CasException(CasException.ACCT_NOTIDTIWITHBANK);
			if (!acctBank.getCompany().getId().equals(journal.getCompany().getId()))
				throw new CasException(CasException.COMPANY_NOTIDTIWITHBANK);
		}
		journal.setHasEffected(true);
	}

	/**
	 * output actionPrint_actionPerformed
	 */
	public void actionPrint_actionPerformed(ActionEvent e) throws Exception {
		super.actionPrint_actionPerformed(e);
	}

	/**
	 * output actionPrintPreview_actionPerformed
	 */
	public void actionPrintPreview_actionPerformed(ActionEvent e) throws Exception {
		super.actionPrintPreview_actionPerformed(e);
	}

	/**
	 * output actionLocate_actionPerformed
	 */
	public void actionLocate_actionPerformed(ActionEvent e) throws Exception {
		super.actionLocate_actionPerformed(e);
	}

	// /**
	// * output actionQuery_actionPerformed
	// */
	// public void actionQuery_actionPerformed(ActionEvent e) throws Exception
	// {
	// super.actionQuery_actionPerformed(e);
	// }

	/**
	 * output actionImportData_actionPerformed
	 */
	public void actionImportData_actionPerformed(ActionEvent e) throws Exception {
		super.actionImportData_actionPerformed(e);
	}

	/**
	 * output actionAttachment_actionPerformed
	 */
	public void actionAttachment_actionPerformed(ActionEvent e) throws Exception {
		super.actionAttachment_actionPerformed(e);
	}

	/**
	 * output actionExportData_actionPerformed
	 */
	public void actionExportData_actionPerformed(ActionEvent e) throws Exception {
		super.actionExportData_actionPerformed(e);
	}

	/**
	 * output actionToExcel_actionPerformed
	 */
	public void actionToExcel_actionPerformed(ActionEvent e) throws Exception {
		super.actionToExcel_actionPerformed(e);
	}

	/**
	 * output actionStartWorkFlow_actionPerformed
	 */
	public void actionStartWorkFlow_actionPerformed(ActionEvent e) throws Exception {
		super.actionStartWorkFlow_actionPerformed(e);
	}

	/**
	 * output actionPublishReport_actionPerformed
	 */
	public void actionPublishReport_actionPerformed(ActionEvent e) throws Exception {
		super.actionPublishReport_actionPerformed(e);
	}

	/**
	 * output actionCancel_actionPerformed
	 */
	public void actionCancel_actionPerformed(ActionEvent e) throws Exception {
		super.actionCancel_actionPerformed(e);
	}

	/**
	 * output actionCancelCancel_actionPerformed
	 */
	public void actionCancelCancel_actionPerformed(ActionEvent e) throws Exception {
		super.actionCancelCancel_actionPerformed(e);
	}

	/**
	 * output actionQueryScheme_actionPerformed
	 */
	public void actionQueryScheme_actionPerformed(ActionEvent e) throws Exception {
		super.actionQueryScheme_actionPerformed(e);
	}

	/**
	 * output actionCreateTo_actionPerformed
	 */
	public void actionCreateTo_actionPerformed(ActionEvent e) throws Exception {
		super.actionCreateTo_actionPerformed(e);
	}

	/**
	 * output actionCopyTo_actionPerformed
	 */
	public void actionCopyTo_actionPerformed(ActionEvent e) throws Exception {
		super.actionCopyTo_actionPerformed(e);
	}

	/**
	 * output actionTraceUp_actionPerformed
	 */
	public void actionTraceUp_actionPerformed(ActionEvent e) throws Exception {
		super.actionTraceUp_actionPerformed(e);
	}

	/**
	 * output actionTraceDown_actionPerformed
	 */
	public void actionTraceDown_actionPerformed(ActionEvent e) throws Exception {
		super.actionTraceDown_actionPerformed(e);
	}

	/**
	 * output actionVoucher_actionPerformed
	 */
	public void actionVoucher_actionPerformed(ActionEvent e) throws Exception {
		super.actionVoucher_actionPerformed(e);
	}

	/**
	 * output actionDelVoucher_actionPerformed
	 */
	public void actionDelVoucher_actionPerformed(ActionEvent e) throws Exception {
		super.actionDelVoucher_actionPerformed(e);
	}

	/**
	 * output actionAuditResult_actionPerformed
	 */
	public void actionAuditResult_actionPerformed(ActionEvent e) throws Exception {
		super.actionAuditResult_actionPerformed(e);
	}

	/**
	 * output actionViewDoProccess_actionPerformed
	 */
	public void actionViewDoProccess_actionPerformed(ActionEvent e) throws Exception {
		super.actionViewDoProccess_actionPerformed(e);
	}

	/**
	 * output actionMultiapprove_actionPerformed
	 */
	public void actionMultiapprove_actionPerformed(ActionEvent e) throws Exception {
		super.actionMultiapprove_actionPerformed(e);
	}

	/**
	 * output actionNextPerson_actionPerformed
	 */
	public void actionNextPerson_actionPerformed(ActionEvent e) throws Exception {
		super.actionNextPerson_actionPerformed(e);
	}

	/**
	 * output actionWorkFlowG_actionPerformed
	 */
	public void actionWorkFlowG_actionPerformed(ActionEvent e) throws Exception {
		super.actionWorkFlowG_actionPerformed(e);
	}

	/**
	 * output actionSendSmsMessage_actionPerformed
	 */
	public void actionSendSmsMessage_actionPerformed(ActionEvent e) throws Exception {
		super.actionSendSmsMessage_actionPerformed(e);
	}

	/**
	 * output actionSignature_actionPerformed
	 */
	public void actionSignature_actionPerformed(ActionEvent e) throws Exception {
		super.actionSignature_actionPerformed(e);
	}

	/**
	 * output actionWorkflowList_actionPerformed
	 */
	public void actionWorkflowList_actionPerformed(ActionEvent e) throws Exception {
		super.actionWorkflowList_actionPerformed(e);
	}

	/**
	 * output actoinViewSignature_actionPerformed
	 */
	public void actoinViewSignature_actionPerformed(ActionEvent e) throws Exception {
		super.actoinViewSignature_actionPerformed(e);
	}

	/**
	 * output actionTDPrint_actionPerformed
	 */
	public void actionTDPrint_actionPerformed(ActionEvent e) throws Exception {
		super.actionTDPrint_actionPerformed(e);
	}

	/**
	 * output actionTDPrintPreview_actionPerformed
	 */
	public void actionTDPrintPreview_actionPerformed(ActionEvent e) throws Exception {
		super.actionTDPrintPreview_actionPerformed(e);
	}

	/**
	 * output getBizInterface method
	 */
	protected com.kingdee.eas.framework.ICoreBase getBizInterface() throws Exception {
		return com.kingdee.eas.custom.yq.df.SubstitutingFactory.getRemoteInstance();
	}

	/**
	 * output createNewData method
	 */
	protected com.kingdee.bos.dao.IObjectValue createNewData() {
		com.kingdee.eas.custom.yq.df.SubstitutingInfo objectValue = new com.kingdee.eas.custom.yq.df.SubstitutingInfo();

		return objectValue;
	}

	// TODO
	private void actionBtnSubmitPaying_actionPerformed11111(ActionEvent e) throws Exception {

		super.actionBtnSubmitPaying_actionPerformed(e);
		checkSelected();
		List idList = getSelectedIdValues();
		// 检查单据状态是否一致
		if (checkStatusISSame()) {
			// KDTSelectBlock bolock = tblMain.getSelectManager().get();
			// IRow row1 = tblMain.getRow(bolock.getTop());
			// String status = row1.getCell("billStatus").getValue().toString();

			// start edit by maomingwu 20130714 获取后台数据实时数据，较为准确
			if (idList.size() < 1) {
				MsgBox.showInfo("未获取界面单据数据，请重新选择！");
				return;
			}
			ISubstituting ISubstituting = null;
			try {
				ISubstituting = SubstitutingFactory.getRemoteInstance();
			} catch (BOSException e1) {
				e1.printStackTrace();
			}
			SubstitutingInfo subinfo = null;
			String id = idList.get(0).toString();
			try {
				subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
			} catch (EASBizException e3) {
				MsgBox.showInfo("获取代发单实体失败！");
				SysUtil.abort();
			} catch (BOSException e3) {
				MsgBox.showInfo("获取代发单实体失败！");
				SysUtil.abort();
			}
			String status = subinfo.getBillStatus().getAlias();
			// end edit by maomingwu 20130714 获取后台数据实时数据，较为准确

			// 当单据状态满足审批时，可进行提交银企互联
			if (status.equals(BillStatuEnum.AUDITOR.getAlias())) {
				Set idSetCorrectNew = new HashSet();
				try {
					// start edit by xuwei 20130713 加入功能互斥锁
					IMutexServiceControl iMutex = MutexServiceControlFactory.getRemoteInstance();
					// 批量申请数据互斥锁
					Map resultRequest = iMutex.batchRequestObjIDForUpdate(idList);
					// 数据申请不成功，返回false，给予提示.
					for (int i = 0; i < idList.size(); i++) {
						Boolean boolResult = (Boolean) resultRequest.get(idList.get(i));
						if (!(boolResult.booleanValue())) {
							MsgBox.showInfo("单据已被锁定，无法提交银企");
						} else {
							idSetCorrectNew.add(idList.get(i));
						}
					}
					// end edit by xuwei 20130713 加入功能互斥锁
					// start edit by maomingwu 20130713
					// 增加判断，单据是否提交银企的值，是否已勾选，若勾选，则操作正在进行中，直接弹出提示不允许操作
					checkStates(idList);
					// end edit by maomingwu 20130713
					// 增加判断，单据是否提交银企的值，是否已勾选，若勾选，则操作正在进行中，直接弹出提示不允许操作
					LongTimeDialog ltDlg = UITools.getDialog(this);
					modifyLongTimeDialogAttribute(ltDlg, "您好，数据正在提交中，请稍等...");
					ltDlg.setLongTimeTask(new ILongTimeTask() {

						final long s2 = System.currentTimeMillis();

						public Object exec() throws Exception {
							List idList = getSelectedIdValues();
							Set idSet = FMHelper.list2Set(idList);
							// 若提交银企互联需要密码,则弹出密码输入框,
							checkPassword();
							// 检查单据状态是否满足条件(即必须为已审核状态),若不满足这弹出提示框
							// start edit by maomingwu 20130713
							// 将方法移到上面执行，确保数据的及时性判断
							// checkStates(idList);
							// end edit by maomingwu
							// 20130713将方法移到上面执行,确保数据的及时性判断
							try {
								// SubstitutingFactory.getRemoteInstance().
								// commitToBE(idSet);
								// 电脑IP
								InetAddress addr = null;
								try {
									addr = InetAddress.getLocalHost();
								} catch (UnknownHostException e) {
									e.printStackTrace();
								}
								String ip = addr.getHostAddress().toString();
								// 电脑名称
								String computerName = addr.getHostName().toString();
								SubstitutingFactory.getRemoteInstance().pay("", idSet, ip, computerName);

							} catch (BEException e1) {
								// MsgBox.showInfo(e1.getMessage());
								// start edit by maomingwu
								// 20130714若后台方法异常，则反写是否提交银企字段为否
								// 若异常，则反写单据是否提交银企字段和时间
								ISubstituting ISubstituting = null;
								SubstitutingInfo subinfo = null;
								String id = idList.get(0).toString();
								try {
									ISubstituting = SubstitutingFactory.getRemoteInstance();
									subinfo = ISubstituting.getSubstitutingInfo(new ObjectUuidPK(id));
								} catch (EASBizException e3) {
									MsgBox.showInfo("获取代发单实体失败！");
									SysUtil.abort();
								} catch (BOSException e3) {
									MsgBox.showInfo("获取代发单实体失败！");
									SysUtil.abort();
								}
								// 更新单据是否提交银企为【否】
								try {
									// 提交银企时间默认为当前时间
									subinfo.setSubmitBankDate(null);
									// 是否提交银企为true
									subinfo.setIsSubmitBank(false);
									SelectorItemCollection item = new SelectorItemCollection();
									item.add(new SelectorItemInfo("submitBankDate"));
									item.add(new SelectorItemInfo("isSubmitBank"));
									ISubstituting.updatePartial(subinfo, item);
								} catch (Exception e) {
									// 若异常，并提示，结束程序
									MsgBox.showInfo("反写代发单主表是否提交银企字段失败！");
									SysUtil.abort();
								}
								// start edit by maomingwu
								// 20130714若后台方法异常，则反写是否提交银企字段为否
								// start edit by maomingwu 20130713
								MsgBox.showConfirm3a("提交异常，请看详细日志！", e1.getMessage());
								// end edit by maomingwu 20130713
								return "";
							}
							return "success";
						}

						public void afterExec(Object reult) throws Exception {
							if (reult != "" && reult != null) {
								if (reult.toString().equals("success")) {
									long s3 = System.currentTimeMillis();
									MsgBox.showInfo("提交银企互联操作已完成,时间为:" + (s3 - s2) / 1000 + "s");
								}
							}
						}
					});

					ltDlg.show();

					// 刷新
					super.actionRefresh_actionPerformed(e);
					// start edit by xuwei 20130713 功能互斥锁 释放
				} catch (Exception en) {
					logger.error("SubstitutingListUI actionBtnSubmitPaying error:" + en.getMessage());
				} finally {
					// 重置释放数据互斥锁
					List idCorrectS = new ArrayList(idSetCorrectNew);
					MutexUtils.releaseMutex(idCorrectS);
				}
				// end edit by xuwei 20130713 功能互斥锁释放
			} else {
				MsgBox.showInfo("只有单据状态为‘已审批’时，才可以进行提交银企互联！");
			}
		} else {
			MsgBox.showInfo("单据状态不一致，不能进行提交银企互联操作！");
		}

	}

}